<div class="mainbox">
    <div class="pay {{ispop&&'focus'}}">
        <div class="orderdetail {{isaddress&&'focus'}}">
            <div class="address">
                {{#if user.pay_ach.info.user_address}}
                <div class="item">
                    <input bind-input="{{'$Cache.sign_in.name'}}" value="{{user.pay_ach.info.user_address.name}}" placeholder="收件人" disabled="disabled" type="text" />
                </div>
                <div class="item">
                    <input value="{{user.pay_ach.info.user_address.mobilenumber}}" placeholder="手机/电话" disabled="disabled" type="text" />
                </div>
                <div class="item">
                    <div class="daddr">
                        {{user.pay_ach.info.user_address.province+', '+user.pay_ach.info.user_address.town+', '+user.pay_ach.info.user_address.county+', '+user.pay_ach.info.user_address.detail}}
                    </div>
                </div>
                {{#if user.pay_ach.info.state==config.ACH_STATE.未确认}}
                <button event-click="{{'$Event.change'}}">更改收货地址</button>
                {{/if}} {{#else}}
                <button event-click="{{'$Event.change'}}">选择收获地址</button>
                {{/if}}
            </div>
        	<div>
        		<input type="text" placeholder="给商家留言" />
        	</div>
        	<div class="paym">
        		<div><span class="title">支付方式</span>{{(user.pay_ach.info.state==config.ACH_STATE.未确认)&&' (点击修改)'||''}}</div>
        		{{#if user.pay_ach.info.state==config.ACH_STATE.未确认}}
        		<paymethod
					value="alipay.wap.auth.authAndExecute"
                    text="支付宝"
                    intro="使用支付宝网页支付"
                    disabled="{{!(bus_info.info.alipay.seller_email&&bus_info.info.alipay.key&&bus_info.info.alipay.partner)}}"	
        		></paymethod>
        		<paymethod
					value="payment_in_cash"
                    text="货到付款"
                    intro="用于大金额订单"
        		></paymethod>
        		{{#else}}
				<paymethod
                    value="alipay.wap.auth.authAndExecute"
                    text="支付宝"
                    intro="使用支付宝网页支付"
                    disabled="true" 
                ></paymethod>
                <paymethod
                    value="payment_in_cash"
                    text="货到付款"
                    disabled="true"
                    intro="用于大金额订单"
                ></paymethod>
        		{{/if}}
        	</div>
        </div>



        <div class="addressbox">
            <button event-click="{{'$Event.change'}}">返回</button>
            <p>点击选择收货地址</p>
            {{#each user.address_detail}}
            <div class="item {{$Top.user.pay_ach.info.user_address._id==_id&&'focus'}}" event-click="{{'$Top.$Event.pays.change_user_address'}}" event-click-new="{{'$Top.$Event.change'}}">
                <span class="name">{{name}}</span>
                <span class="phone">{{mobilenumber}} {{phonenumber&&("/"+phonenumber)}}</span>
                <div>{{province}}{{town}}{{county}}，{{detail}}</div>
            </div>
            {{/each}}
            <br/>
            <button event-click="{{'$Event.isadd'}}">{{isadd&&'取消'||'新增收货地址'}}</button>
            <div class="add {{isadd&&'focus'}}">
                <select name="province" event-change="{{'$Event.province'}}">
                    <option class="first" value="0">请选择省</option>
                    {{#each city_list}}
                    <option rel="{{region_id}}" value="{{region_name}}">
                        {{region_name}}
                    </option>
                    {{/each}}
                </select>

                <select name="city" disabled event-change="{{'$Event.city'}}">
                    <option class="first" value="0">请选择市</option>
                </select>

                <select name="area" disabled>
                    <option class="first" value="0">请选择地区</option>
                </select>
                <div class="aitem">
                    <input name="detailed_addre" type="text" placeholder="街道地址" />
                </div>
                <div class="aitem">
                    <input name="name" type="text" placeholder="收件人" />
                </div>
                <div class="aitem">
                    <input name="mobile_num" type="text" placeholder="手机号" />
                </div>
                <button event-click="{{'$Event.add_user_address'}}">确认增加</button>
            </div>
        </div>
    </div>
    <div class="topay">
        <div class="item">商品总计：<span class="price">￥{{#Fixed user.pay_ach.cash}}</span></div>
        <div class="item" event-click="{{#if user.pay_ach.info.state==11}}{{'$Event.showCover'}}{{/if}}">
            {{#> "user_ach_controller","user.pay_ach"}}
        </div>
    </div>
</div>

<xmp type="tag" name="paymethod">
	<div event-click="{{'$Event.changepay'}}" class="paymethod {{($Top.$Cache.pays.buy_method=='${value}'||user.pay_ach.info.pay_method=='${value}')&&'focus'}}">
		<input class="radio" type="radio" checked="false" bind-input="{{'$Top.$Cache.pays.buy_method'}}" name="pay-type" event-change="{{'$Top.$Event.pays.change_pay_method'}}" ${__all_attrs__}>
		<div class="info" >
			<div class="ptitle" >${text}</div>
			<div>${intro}</div>
		</div>
	</div>
	<script type="text/vm">
	function(vm){
		require(["jQuery"],function($){
            vm.set('$Event.changepay',function(e){
                $(this).find('.radio').click();
			});
		})
	}
	</script>
</xmp>
<script type="text/javascript">
    $("[name='gopay']").click(function() {
            App.set("ispop",true);
        })
</script>